/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.skali.cabdirectories.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping;
import com.skali.cabdirectories.model.CABDirectory_DLFileEntryMappingModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the CABDirectory_DLFileEntryMapping service. Represents a row in the &quot;CABDirectories_CABDirectory_DLFileEntryMapping&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.skali.cabdirectories.model.CABDirectory_DLFileEntryMappingModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CABDirectory_DLFileEntryMappingImpl}.
 * </p>
 *
 * @author Prabhakar
 * @see CABDirectory_DLFileEntryMappingImpl
 * @see com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping
 * @see com.skali.cabdirectories.model.CABDirectory_DLFileEntryMappingModel
 * @generated
 */
public class CABDirectory_DLFileEntryMappingModelImpl extends BaseModelImpl<CABDirectory_DLFileEntryMapping>
	implements CABDirectory_DLFileEntryMappingModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a c a b directory_ d l file entry mapping model instance should use the {@link com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping} interface instead.
	 */
	public static final String TABLE_NAME = "CABDirectories_CABDirectory_DLFileEntryMapping";
	public static final Object[][] TABLE_COLUMNS = {
			{ "mappingId", Types.BIGINT },
			{ "SammId", Types.BIGINT },
			{ "dlFileEntryId", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table CABDirectories_CABDirectory_DLFileEntryMapping (mappingId LONG not null primary key,SammId LONG,dlFileEntryId LONG)";
	public static final String TABLE_SQL_DROP = "drop table CABDirectories_CABDirectory_DLFileEntryMapping";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping"),
			true);
	public static long DLFILEENTRYID_COLUMN_BITMASK = 1L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping"));

	public CABDirectory_DLFileEntryMappingModelImpl() {
	}

	public long getPrimaryKey() {
		return _mappingId;
	}

	public void setPrimaryKey(long primaryKey) {
		setMappingId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_mappingId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return CABDirectory_DLFileEntryMapping.class;
	}

	public String getModelClassName() {
		return CABDirectory_DLFileEntryMapping.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("mappingId", getMappingId());
		attributes.put("SammId", getSammId());
		attributes.put("dlFileEntryId", getDlFileEntryId());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long mappingId = (Long)attributes.get("mappingId");

		if (mappingId != null) {
			setMappingId(mappingId);
		}

		Long SammId = (Long)attributes.get("SammId");

		if (SammId != null) {
			setSammId(SammId);
		}

		Long dlFileEntryId = (Long)attributes.get("dlFileEntryId");

		if (dlFileEntryId != null) {
			setDlFileEntryId(dlFileEntryId);
		}
	}

	public long getMappingId() {
		return _mappingId;
	}

	public void setMappingId(long mappingId) {
		_mappingId = mappingId;
	}

	public long getSammId() {
		return _SammId;
	}

	public void setSammId(long SammId) {
		_SammId = SammId;
	}

	public long getDlFileEntryId() {
		return _dlFileEntryId;
	}

	public void setDlFileEntryId(long dlFileEntryId) {
		_columnBitmask |= DLFILEENTRYID_COLUMN_BITMASK;

		if (!_setOriginalDlFileEntryId) {
			_setOriginalDlFileEntryId = true;

			_originalDlFileEntryId = _dlFileEntryId;
		}

		_dlFileEntryId = dlFileEntryId;
	}

	public long getOriginalDlFileEntryId() {
		return _originalDlFileEntryId;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			CABDirectory_DLFileEntryMapping.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public CABDirectory_DLFileEntryMapping toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (CABDirectory_DLFileEntryMapping)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	public CABDirectory_DLFileEntryMapping toUnescapedModel() {
		return (CABDirectory_DLFileEntryMapping)this;
	}

	@Override
	public Object clone() {
		CABDirectory_DLFileEntryMappingImpl cabDirectory_DLFileEntryMappingImpl = new CABDirectory_DLFileEntryMappingImpl();

		cabDirectory_DLFileEntryMappingImpl.setMappingId(getMappingId());
		cabDirectory_DLFileEntryMappingImpl.setSammId(getSammId());
		cabDirectory_DLFileEntryMappingImpl.setDlFileEntryId(getDlFileEntryId());

		cabDirectory_DLFileEntryMappingImpl.resetOriginalValues();

		return cabDirectory_DLFileEntryMappingImpl;
	}

	public int compareTo(
		CABDirectory_DLFileEntryMapping cabDirectory_DLFileEntryMapping) {
		long primaryKey = cabDirectory_DLFileEntryMapping.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof CABDirectory_DLFileEntryMapping)) {
			return false;
		}

		CABDirectory_DLFileEntryMapping cabDirectory_DLFileEntryMapping = (CABDirectory_DLFileEntryMapping)obj;

		long primaryKey = cabDirectory_DLFileEntryMapping.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		CABDirectory_DLFileEntryMappingModelImpl cabDirectory_DLFileEntryMappingModelImpl =
			this;

		cabDirectory_DLFileEntryMappingModelImpl._originalDlFileEntryId = cabDirectory_DLFileEntryMappingModelImpl._dlFileEntryId;

		cabDirectory_DLFileEntryMappingModelImpl._setOriginalDlFileEntryId = false;

		cabDirectory_DLFileEntryMappingModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<CABDirectory_DLFileEntryMapping> toCacheModel() {
		CABDirectory_DLFileEntryMappingCacheModel cabDirectory_DLFileEntryMappingCacheModel =
			new CABDirectory_DLFileEntryMappingCacheModel();

		cabDirectory_DLFileEntryMappingCacheModel.mappingId = getMappingId();

		cabDirectory_DLFileEntryMappingCacheModel.SammId = getSammId();

		cabDirectory_DLFileEntryMappingCacheModel.dlFileEntryId = getDlFileEntryId();

		return cabDirectory_DLFileEntryMappingCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{mappingId=");
		sb.append(getMappingId());
		sb.append(", SammId=");
		sb.append(getSammId());
		sb.append(", dlFileEntryId=");
		sb.append(getDlFileEntryId());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append(
			"com.skali.cabdirectories.model.CABDirectory_DLFileEntryMapping");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>mappingId</column-name><column-value><![CDATA[");
		sb.append(getMappingId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>SammId</column-name><column-value><![CDATA[");
		sb.append(getSammId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dlFileEntryId</column-name><column-value><![CDATA[");
		sb.append(getDlFileEntryId());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = CABDirectory_DLFileEntryMapping.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			CABDirectory_DLFileEntryMapping.class
		};
	private long _mappingId;
	private long _SammId;
	private long _dlFileEntryId;
	private long _originalDlFileEntryId;
	private boolean _setOriginalDlFileEntryId;
	private long _columnBitmask;
	private CABDirectory_DLFileEntryMapping _escapedModel;
}